package org.lt.resume.controller.user;

import java.util.List;

import org.apache.struts2.json.annotations.JSON;
import org.lt.resume.service.userserviceInterface.UserServiceInterface;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class SearchUserforTableController extends ActionSupport {

	/****/
	private static final long serialVersionUID = -8005966049840226434L;

	private UserServiceInterface userservice;

	private String username;

	private List items;

	@Override
	public String execute() throws Exception {

		if(username.trim().equals("")) {
			items = userservice.seachUser(0);
		} else {
		   items = userservice.seachUserForTable(username);
		}
		return Action.SUCCESS;
	}

	@JSON(name="items")
	public List getItems() {
		return items;
	}

	public void setItems(List items) {
		this.items = items;
	}

	public void setUsername(String username) {
		this.username = username;
	}

//	public UserServiceInterface getUserservice() {
//		return userservice;
//	}

	public void setUserservice(UserServiceInterface userservice) {
		this.userservice = userservice;
	}

}
